<?php

global $_W, $_GPC;
$uid = 9669;
$sonid = 2466;
$lessonid = 299;
$weid = 20;

$params = array(':weid' => $weid, ':uid' => $uid, ':lessonid' => $lessonid, ':sonid' => $sonid);
$practiceRecord = pdo_fetchall("select * from " . tablename('goouc_class_practice_record') . "  where weid = :weid AND uid = :uid AND lessonid =:lessonid AND sonid=:sonid order by id desc limit 1", $params);

$record = unserialize($practiceRecord[0]['record']);

var_dump($practiceRecord[0]['record']);die;
$types_config = array('1' => '判断题', '2' => '单选题', '3' => '多选题', '4' => '填空题');
$weid = $_W['uniacid'];
$paramsl = [':weid' => $weid, ':sonid' => $sonid, ':lessonid' => $lessonid, ':status' => 1];
$practiceList = pdo_fetchall("select * from " . tablename('goouc_class_practice') . "  where weid = :weid AND sonid = :sonid AND status = :status AND lessonid = :lessonid", $paramsl);

foreach ($practiceList as $k => &$v) {
    if ($v['thumb']) {
        $v['thumb'] = $this->getImgUrl($v['thumb']);
    }
    if ($v['type'] == 2 || $v['type'] == 3) {
        $v['items'] = unserialize($v['items']);
        if ($v['isimg'] == 1) {
            $img_items = unserialize($v['img_items']);
            foreach ($img_items as &$vi) {
                $vi['p'] = $this->getImgUrl($vi['p']);
            }
            $v['img_items'] = $img_items;
        }
    } elseif ($v['type'] == 4) {
        //计算填空数
        $v['answersNum'] = explode("、", $v['answer']);//这个该怎么计算
    }
    $v['practiceType'] = $types_config[$v['type']];
    //用户该题对错
    $v['userstatus'] = $record[$v['id']]['status'];
    $v['useranswer'] = $record[$v['id']]['uanswer'];
}